package trie.leecode;

import trie.TrieSet;

/**
 * @author yuisama
 * @date 2022/10/12 14:29
 * 自己实现字典树 - Num208
 **/
public class Trie {
    private TrieSet trieSet;
    public Trie() {
        trieSet = new TrieSet();
    }

    public void insert(String word) {
        trieSet.add(word);
    }

    public boolean search(String word) {
        return trieSet.contains(word);
    }

    public boolean startsWith(String prefix) {
        return trieSet.startsWith(prefix);
    }
}